package cate.common.table.ins;


import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cp.solution.util.str.Str;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@NoteClass("英雄实例")
public class InstanceHeroRow extends ERow {

    @NoteField("英雄id")
    public int heroTid;

    @NoteField("等级")
    public int level;

    @NoteField("阶数")
    public int grade;

    @NoteField("重写战斗属性")
    public String rewriteAttrCode;

    @NoteField("重写技能")
    public String rewriteSkillCode;

    @NoteField("附加属性")
    public String exAttrCode;

    @NoteField("附加技能")
    public String exSkillCode;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("id", -1);
        this.heroTid = xrw.getInteger("英雄id", 0);
        this.level = xrw.getInteger("等级", 1);
        this.grade = xrw.getInteger("阶数", 0);
        this.rewriteAttrCode = xrw.getString("重写战斗属性");
        this.rewriteSkillCode = xrw.getString("重写技能");

        this.exAttrCode = xrw.getString("附加属性");
        this.exSkillCode = xrw.getString("附加技能");

    }



    public List<Integer> rewriteSkills;

    public List<Integer> exSkills;

    @Override
    public void decode() {
        if (StringUtils.isNotBlank(rewriteSkillCode)) {
            rewriteSkills = Str.strArr2intList(rewriteSkillCode.split("#"));
        }
        if (StringUtils.isNotBlank(exSkillCode)) {
            exSkills = Str.strArr2intList(exSkillCode.split("#"));
        }
    }

}
